package com.hj.javaweb.controller;


import com.hj.javaweb.R.R;
import com.hj.javaweb.entity.City;
import com.hj.javaweb.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 中国城市行政区划表（省/市/区三级）(City)表控制层
 *
 * @author makejava
 * @since 2025-11-16 19:10:20
 */
@RestController
@RequestMapping("/city")
public class CityController {

    @Resource
    private CityService cityService;
    @Autowired
    private RedisTemplate<String,Object> redisTemplate;
    
    @GetMapping("/getCityById")
    public R<City> getCityFromRedisById(String cityCode){
        City city = (City) redisTemplate.opsForValue().get(cityCode);
        return R.ok(city);
    }

}

